<template>
	<view class=" ">
		<tn-nav-bar fixed alpha :isBack="true">
			交友墙
		</tn-nav-bar>

		<mescroll-body ref="mescrollRef" @down="downCallback" @up="upCallback"	:style="{paddingTop: vuex_custom_bar_height + 'px'}">
			<view class='nav-list  tn-margin-top'>
				<view class="nav-list-item tn-padding tn-shadow-blur tn-main-gradient-blue--light">
					<view class="article-shadow ">
						<view class="tn-flex">
							<view class="image-pic tn-margin-sm" :style="'background-image:url(' + item.avatar + ')'">
								<view class="image-article">

								</view>
							</view>
							<view class="tn-margin-sm tn-padding-top-xs" style="width: 100%;">
								<view class="tn-flex tn-flex-row-between">
									<view class="justify-content-item  tn-text-center tn-color-bule">
										{{item.nickname}}
									</view>
									<view class="justify-content-item tn-round tn-text-xs  tn-color-black"
										style="padding: 5rpx 15rpx;background-color: #00FFC6 !important;">
										<text class="tn-icon-circle-fill"></text>{{item.tag}}
									</view>
								</view>
								<view class="tn-flex tn-flex-row-between tn-flex-col-between">
									<view class="justify-content-item  tn-text-center tn-color-black "
										style="padding-top: 5rpx;font-size: 12px;">
										<text
											class="tn-padding-right tn-text-df  tn-icon-location-fill">{{item.city}}</text>
										<text>
											{{item.shengri.age}}/{{item.shengri.animals}}/{{item.shengri.constellation}}
										</text>
									</view>
								</view>
							</view>
						</view>
					</view>

					<view class="tn-padding-top-xs">
						<view class="tn-padding-top-xs">
							<view class="tn-color-black tn-bold-border tn-padding-bottom">交友宣言：</view>
							<text class="tn-text-df tn-color-black  tn-text-justify ">
								{{ item.dec }}
							</text>
						</view>
					</view>

		</view>	
		</view>
		<view class='nav-list tn-margin-bottom '>
			<view class="nav-list-item tn-padding tn-shadow-blur tn-main-gradient-blue--light">
				
				
				<view class="tn-padding-sm" v-if="content.length==0">
					<tn-button padding="40rpx 20rpx" shape="round" width="100%"
						style="background-color: rgb(0 0 0 /0.16)">
						<view class="tn-text-left">
					<text class="">赶紧来做TA的第一个响应人吧</text>
					</view>
					</tn-button>
				</view>
				
					<block v-for="(item, index) in content" :key="index">
						<view class="tn-padding-sm">
							<tn-button padding="40rpx 20rpx" shape="round" width="100%"
								style="background-color: rgb(0 0 0 /0.16)">
								<view class="tn-text-left">
							<text class="">{{item.username}}：</text>	<text class="tn-color-yellow">{{item.dec}}</text>
							</view>
							</tn-button>
						</view>
					</block>


				</view>


			</view>
		</mescroll-body>

		<view class="input-box">
			<view class="textbox">
				<view class="text-mode">
					<view class="box">
						<input auto-height="true" @blur="lostfocus" :adjust-position="true" v-model="sendmsgBoy"
							style="font-size: 14px;" cursor-spacing="10" :placeholder="huifubody"
							placeholder-style="font-size: 14px;" :focus="is_focus" />
					</view>

				</view>
			</view>

			<view class="send " @tap="sendmsg">
				<view class="btn">发送</view>
			</view>
		</view>
	</view>
</template>

<script>
	import template_page_mixin from '@/libs/mixin/template_page_mixin.js'
	import MescrollBody from '@/components/mescroll-uni/mescroll-body.vue';
	import MescrollUni from '@/components/mescroll-uni/mescroll-uni.vue';
	import MescrollMixin from '@/components/mescroll-uni/mescroll-mixins.js';
	export default {
		name: 'TemplateGroup',
		mixins: [template_page_mixin, MescrollMixin],
		components: {
			MescrollBody
		},
		data() {
			return {
				huifubody: '留下你的足迹吧',
				is_focus: false,
				sendmsgBoy: '',
				id: 0,
				type: '',
				content: [],
				managelist: [],
				item: []
			}
		},
		onLoad(option) {
			if (option.id) {
				this.id = option.id
			}
			if (option.type) {
				this.type = option.type
			}
			this.info()

		},
		methods: {
			lostfocus() {
				this.is_focus = false
			},
			async info() {
				let that = this;
				let result = await that.$request({
					loading: 0,
					method: 'post',
					url: '/chat/love/wallshow',
					data: {
						id: that.id
					}
				});

				if (result.statusCode == 200) {
					that.item = result.data.data
				}
			},
			
			async sendmsg() {
				let that = this;
				let result = await that.$request({
					loading: 1,
					method: 'post',
					url: '/chat/love/lovewallsend',
					data: {
						id: that.id,
						dec: that.sendmsgBoy
					}
				});
			
				if (result.statusCode == 200) {
					that.sendmsgBoy=''					
					that.msg('响应成功')				
					this.mescroll.resetUpScroll()		 
				}
			},
			
			
			
			
			
			
			jinru(id) {
				this.navigateToFn({
					url: '/friendMixinPages/lovewall/show?id=' + id,
					checkLogin: false
				})
			},
			downCallback(mescroll) {
				mescroll.endSuccess();
				mescroll.resetUpScroll();
			},
			async upCallback(mescroll) {
				let that = this;

				let result = await that.$request({
					loading: 1,
					method: 'post',
					url: '/chat/love/love_comment',
					data: {
						id: that.id,
						page: mescroll.num
					}
				});
				if (result.statusCode == 200) {
					if (result.data.code == 200) {

						if (mescroll.num == 1) {
							that.content = result.data.data.data;
						} else {
							that.content = that.content.concat(result.data.data.data);
						}
						mescroll.endSuccess(result.data.data.data.length, result.data.data.data.length >= mescroll
							.size);

					} else {
						uni.showToast({
							icon: 'none',
							title: result.data.msg
						});
					}
				} else {
					uni.showToast({
						icon: 'none',
						title: that.$errorMsg
					});
				}
			},

		}
	}
</script>
<style lang="scss" scoped>
	/* 胶囊*/
	.template-wave {
		background-image: linear-gradient(to top, #aaffff 20%, #c4e1b2 80%);
		width: 100vw;
		height: 100vh;
	}

	/* 标题 start */
	.nav_title {
		-webkit-background-clip: text;
		color: transparent;

		&--wrap {
			position: relative;
			display: flex;
			height: 120rpx;
			align-items: center;
			justify-content: center;
			font-weight: bold;
			background-size: cover;
		}
	}

	.tn-custom-nav-bar__back {
		width: 100%;
		height: 100%;
		position: relative;
		display: flex;
		justify-content: space-evenly;
		align-items: center;
		box-sizing: border-box;
		background-color: rgba(0, 0, 0, 0.15);
		border-radius: 1000rpx;
		border: 1rpx solid rgba(255, 255, 255, 0.5);
		color: #FFFFFF;
		font-size: 18px;

		.icon {
			display: block;
			flex: 1;
			margin: auto;
			text-align: center;
		}

		&:before {
			content: " ";
			width: 1rpx;
			height: 110%;
			position: absolute;
			top: 22.5%;
			left: 0;
			right: 0;
			margin: auto;
			transform: scale(0.5);
			transform-origin: 0 0;
			pointer-events: none;
			box-sizing: border-box;
			opacity: 0.7;
			background-color: #FFFFFF;
		}
	}

	/* 轮播视觉差 start */
	.card-swiper {
		height: 400rpx !important;
	}

	.card-swiper swiper-item {
		width: 600rpx !important;
		box-sizing: border-box;
		padding: 0rpx 0rpx 40rpx 0rpx;
		overflow: initial;
	}

	.card-swiper swiper-item .swiper-item {
		width: 100%;
		display: block;
		height: 100%;
		border-radius: 10rpx;
		transform: scale(0.85);
		transition: all 0.2s ease-in 0s;
		// 图片背景阴影形式不能要这个
		// overflow: hidden;
	}

	.card-swiper swiper-item.cur .swiper-item {
		transform: none;
		transition: all 0.2s ease-in 0s;
	}

	.card-swiper swiper-item .swiper-item-text {
		text-align: center;
		margin-top: -220rpx;
		width: 100%;
		display: block;
		height: 70%;
		border-radius: 10rpx;
		transform: translate(0rpx, -60rpx) scale(0.8);
		transition: all 0.6s ease 0s;
		overflow: hidden;
	}

	.card-swiper swiper-item.cur .swiper-item-text {
		text-align: center;
		margin-top: -280rpx;
		width: 100%;
		transform: translate(0rpx, 0rpx) scale(0.9, 0.9);
		transition: all 0.6s ease 0s;
	}

	.image-banner {
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.image-banner image {
		width: 100%;
		height: 100%;
	}

	/* banner start */
	.banner-image {
		height: 500rpx;
		position: relative;
	}

	.banner-pic {
		background-size: cover;
		background-repeat: no-repeat;
		// background-attachment:fixed;
		background-position: top;
		box-shadow: 0rpx 0rpx 80rpx 0rpx rgba(0, 0, 0, 0.15);
		overflow: hidden;
		// background-color: #FFFFFF;
	}


	/* 轮播指示点 start*/
	.indication {
		z-index: 9999;
		width: 100%;
		height: 36rpx;
		position: absolute;
		display: flex;
		flex-direction: row;
		align-items: center;
		justify-content: center;
	}

	.spot {
		background-color: #E6E6E6;
		opacity: 0.6;
		width: 10rpx;
		height: 10rpx;
		border-radius: 20rpx;
		top: -20rpx;
		margin: 0 8rpx !important;
		position: relative;
	}

	.spot.active {
		opacity: 1;
		width: 30rpx;
		background-color: #FFA726;
	}


	/* 图标容器5 start */
	.icon5 {
		&__item {
			// width: 30%;
			background-color: #FFFFFF;
			border-radius: 10rpx;
			padding: 0rpx;
			margin: 0rpx;
			transform: scale(1);
			transition: transform 0.3s linear;
			transform-origin: center center;

			&--icon {
				width: 100rpx;
				height: 100rpx;
				border-radius: 50%;
				margin-bottom: 18rpx;
				position: relative;
				z-index: 1;
			}
		}
	}

	/* 图标容器5 start */
	.icon17 {
		&__item {
			// width: 30%;
			background-color: #FFFFFF;
			border-radius: 10rpx;
			padding: 0rpx;
			margin: 0rpx;
			transform: scale(1);
			transition: transform 0.3s linear;
			transform-origin: center center;

			&--icon {
				width: 90rpx;
				height: 90rpx;
				border-radius: 50%;
				margin-bottom: 18rpx;
				position: relative;
				z-index: 1;
			}
		}
	}

	/* 组件导航列表 start*/
	.nav-list {
		display: flex;
		flex-wrap: wrap;
		padding: 0rpx 12rpx 0rpx;
		justify-content: space-between;

		/* 列表元素 start */
		.nav-list-item {
			border-radius: 12rpx;
			width: 100%;
			margin: 0 18rpx 40rpx;
			background-size: cover;
			background-position: center;
			position: relative;
			z-index: 99;

			/* 元素标题 start */
			.nav-link {
				font-size: 32rpx;
				text-transform: capitalize;
				padding: 0 0 10rpx 0;
				position: relative;

				.title {
					color: #FFFFFF;
					margin-top: 80rpx;
					text-align: center;
				}

				.juli {
					color: #FFFFFF;
					margin-top: 10rpx;
					padding: 10rpx;
					text-align: center;
				}

				.join {
					color: #FFFFFF;
					margin-top: 10rpx;
					margin-bottom: 40rpx;

					text-align: center;
				}
			}

			/* 元素标题 end */

			/* 元素图标 start */
			.icon {
				font-variant: small-caps;
				position: absolute;
				top: 60rpx;
				right: 50rpx;
				left: 37%;
				width: 90rpx;
				height: 90rpx;
				line-height: 90rpx;
				margin: 0;
				padding: 0;
				display: inline-flex;
				text-align: center;
				justify-content: center;
				vertical-align: middle;
				font-size: 50rpx;
				color: #FFFFFF;
				white-space: nowrap;
				opacity: 0.9;
				background-color: rgba(0, 0, 0, 0.05);
				background-size: cover;
				background-position: 50%;
				border-radius: 5000rpx;


			}

			/* 元素图标 end */
		}

		/* 列表元素 end */
	}

	/* 组件导航列表 end*/


	/* 文字截取*/
	.clamp-text-1 {
		-webkit-line-clamp: 1;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		text-overflow: ellipsis;
		overflow: hidden;
	}

	.clamp-text-2 {
		-webkit-line-clamp: 2;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		text-overflow: ellipsis;
		overflow: hidden;
	}

	/* 重力*/
	.item {
		&__1 {
			position: absolute;
			top: 210rpx;
			left: 84rpx;
			width: 100%;
			// height: 100%;
			z-index: 5;
		}

		&__2 {
			position: absolute;
			top: 885rpx;
			left: 84rpx;
			width: 100%;
			// height: 100%;
			z-index: 4;
		}

		&__3 {
			position: absolute;
			top: 138rpx;
			left: 88rpx;
			width: 100%;
			// height: 100%;
			z-index: 3;
		}

		&__4 {
			position: absolute;
			top: 390rpx;
			left: 84rpx;
			width: 100%;
			// height: 100%;
			z-index: 2;
		}

		&__animation {
			transition: transform 0.6s ease;
		}
	}

	.image-article {
		border-radius: 8rpx;
		width: 100rpx;
		height: 100rpx;
		position: relative;
	}

	.image-pic {
		background-size: cover;
		background-repeat: no-repeat;
		// background-attachment:fixed;
		background-position: top;

	}

	.article-shadow {
		border-radius: 15rpx;

	}

	/deep/.input-placeholder {
		font-size: 30rpx;
		color: #C6D1D8;
	}

	.input-box {
		width: 100vw;
		min-height: 100upx;
		padding: 0 1%;
		background-color: #f2f2f2;
		display: flex;
		position: fixed;
		z-index: 120;
		bottom: -2upx;

		.voice {
			padding: 10px;
		}

		.send {
			//H5发送按钮左边距
			/* #ifdef H5 */
			margin-left: 20upx;
			/* #endif */
			flex-shrink: 0;
			width: 130upx;
			height: 100upx;
			display: flex;
			align-items: center;

			.btn {
				font-weight: bold;
				border-radius: 2500px !important;
				width: 120upx;
				height: 56upx;
				display: flex;
				justify-content: center;
				align-items: center;
				background-color: #FFF420;
				color: #000000;
				border-radius: 6upx;
				font-size: 24upx;
			}
		}

		.textbox {
			padding: 0 20px;
			width: 100%;
			min-height: 70upx;
			margin-top: 15upx;

			.voice-mode {
				width: calc(100% - 2upx);
				height: 68upx;
				border-radius: 70upx;
				border: solid 1upx #cdcdcd;
				display: flex;
				justify-content: center;
				align-items: center;
				font-size: 28upx;
				background-color: #fff;
				color: #555;

				&.recording {
					background-color: #e5e5e5;
				}
			}

			.text-mode {
				width: 100%;
				min-height: 70upx;
				display: flex;
				background-color: #fff;
				border-radius: 40upx;

				.box {
					width: 100%;

					padding-left: 30upx;
					min-height: 70upx;
					display: flex;
					align-items: center;

					textarea {
						width: 100%;
					}
				}

				.em {
					flex-shrink: 0;
					width: 80upx;
					padding-left: 10upx;
					height: 70upx;
					display: flex;
					justify-content: center;
					align-items: center;
				}
			}
		}
	}
</style>